home *** CD-ROM | disk | FTP | other *** search
/ The Utilities Experience / The Utilities Experience - Volume 1.iso / software / misc / o-z / x-windows / mesa-amiwin / include / gl / xmesa.h < prev   
Encoding:
C/C++ Source or Header  |  1995-12-03  |  4.6 KB  |  185 lines

  1. /* xmesa.h */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  1.2
  6.  * Copyright (C) 1995  Brian Paul  (brianp@ssec.wisc.edu)
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25. $Id: xmesa.h,v 1.7 1995/10/12 16:58:55 brianp Exp $
  26.  
  27. $Log: xmesa.h,v $
  28.  * Revision 1.7  1995/10/12  16:58:55  brianp
  29.  * fixed up include files
  30.  *
  31.  * Revision 1.6  1995/05/22  17:03:21  brianp
  32.  * Release 1.2
  33.  *
  34.  * Revision 1.5  1995/05/15  16:11:41  brianp
  35.  * added share_list argument to XMesaCreateContext()
  36.  *
  37.  * Revision 1.4  1995/04/19  13:47:56  brianp
  38.  * added XMesaGetBackBuffer()
  39.  *
  40.  * Revision 1.3  1995/04/17  14:42:32  brianp
  41.  * API changes: XMesaCreateContext, XMesaBindWindow, XMesaBindPixmap
  42.  *
  43.  * Revision 1.2  1995/03/04  19:45:47  brianp
  44.  * 1.1 beta revision
  45.  *
  46.  * Revision 1.1  1995/02/28  21:21:03  brianp
  47.  * Initial revision
  48.  *
  49.  */
  50.  
  51.  
  52. /*
  53.  * Mesa/X11 interface.  This header file serves as the documentation for
  54.  * the Mesa/X11 interface functions.
  55.  */
  56.  
  57.  
  58. /* Sample Usage:
  59.  
  60. 1. Make the X11 calls needed to open the display, select a visual, make a
  61.    colormap, open a window, etc.
  62.  
  63. 2. Call XMesaCreateContext() to create an X/Mesa rendering context.
  64.  
  65. 3. Call XMesaBindWindow() to bind the context to your window.
  66.    (or XMesaBindPixmap() to bind the context to an off-screen pixmap).
  67.  
  68. 4. Call XMesaMakeCurrent() to make the context the active one.
  69.  
  70. 5. Make gl* calls to render your graphics.
  71.  
  72. 6. Use XMesaSwapBuffers() when double buffering to update the window.
  73.  
  74. 7. When exiting, call XMesaDestroyContext().
  75.  
  76. */
  77.  
  78.  
  79.  
  80.  
  81. #ifndef XMESA_H
  82. #define XMESA_H
  83.  
  84.  
  85. #ifdef __cplusplus
  86. extern "C" {
  87. #endif
  88.  
  89.  
  90. #include <X11/Xlib.h>
  91. #include <X11/Xutil.h>
  92. #include "GL/gl.h"
  93.  
  94. #ifdef AMIWIN
  95. #include <pragmas/xlib_pragmas.h>
  96. extern struct Library *XLibBase;
  97. #endif
  98.  
  99. /*
  100.  * This is the XMesa context 'handle':
  101.  */
  102. typedef struct xmesa_context *XMesaContext;
  103.  
  104.  
  105.  
  106. /*
  107.  * Create a new XMesaContext for rendering into an X11 window.
  108.  *
  109.  * Input:  display - X11 display
  110.  *         window - X11 window to render into.
  111.  *         rgb_flag - GL_TRUE = RGB mode,
  112.  *                    GL_FALSE = color index mode
  113.  *         db_flag - GL_TRUE = double-buffered,
  114.  *                   GL_FALSE = single buffered
  115.  *         ximage_flag - GL_TRUE = use an XImage for back buffer,
  116.  *                       GL_FALSE = use an off-screen pixmap for back buffer
  117.  *         share_list - another XMesaContext with which to share display
  118.  *                      lists or NULL if no sharing is wanted.
  119.  * Return:  an XMesaContext or NULL if error.
  120.  */
  121. extern XMesaContext XMesaCreateContext( Display *display,
  122.                         XVisualInfo *visinfo,
  123.                         GLboolean rgb_flag,
  124.                         GLboolean db_flag,
  125.                         GLboolean ximage_flag,
  126.                         XMesaContext share_list );
  127.  
  128.  
  129. /*
  130.  * Destroy a rendering context as returned by XMesaCreateContext()
  131.  */
  132. extern void XMesaDestroyContext( XMesaContext ctx );
  133.  
  134.  
  135. /*
  136.  * Bind an X/Mesa context to an X window.
  137.  */
  138. extern GLboolean XMesaBindWindow( XMesaContext c, Window w );
  139.  
  140.  
  141. /*
  142.  * Bind an X/Mesa context to an X pixmap.
  143.  */
  144. extern GLboolean XMesaBindPixmap( XMesaContext c, Pixmap p );
  145.  
  146.  
  147. /*
  148.  * Make the specified context the current one.
  149.  */
  150. extern GLboolean XMesaMakeCurrent( XMesaContext ctx );
  151.  
  152.  
  153. /*
  154.  * Return a handle to the current context.
  155.  */
  156. extern XMesaContext XMesaGetCurrentContext( void );
  157.  
  158.  
  159. /*
  160.  * Swap the front and back buffers for the current context.  No action is
  161.  * taken if the context is not double buffered.
  162.  */
  163. extern void XMesaSwapBuffers( void );
  164.  
  165.  
  166. /*
  167.  * Return a pointer to the XMesa backbuffer Pixmap or XImage.  This function
  168.  * is a way to get "under the hood" of X/Mesa so one can manipulate the
  169.  * back buffer directly.
  170.  * Output:  pixmap - pointer to back buffer's Pixmap, or 0
  171.  *          ximage - pointer to back buffer's XImage, or NULL
  172.  * Return:  GL_TRUE = context is double buffered
  173.  *          GL_FALSE = context is single buffered
  174.  */
  175. extern GLboolean XMesaGetBackBuffer( Pixmap *pixmap, XImage **ximage );
  176.  
  177.  
  178.  
  179. #ifdef __cplusplus
  180. }
  181. #endif
  182.  
  183.  
  184. #endif
  185.